/**
 * AreaAction.java
 *2013年9月25日下午8:20:24
 *LINKT
 */
package com.jskj.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.jskj.bean.Xzqh;
import com.jskj.commons.BaseAction;
import com.jskj.dao.DaoSwjg;
import com.jskj.dao.DaoXzqh;

/**
 * @author LINKT
 *
 */
public class AreaAction extends BaseAction {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        
        private String node;
        
        public String getNode() {
                return node;
        }

        public void setNode(String node) {
                this.node = node;
        }

        public void getAreaList() {
                String str;
                HttpServletRequest request=ServletActionContext.getRequest();
                HttpSession session=request.getSession();
                Xzqh xzqh=new Xzqh();
                DaoXzqh daoXzqh=new DaoXzqh();
                xzqh=daoXzqh.getXzqhforDm((String)session.getAttribute("xzqh_dm"));
                if (node.equals("root")){
                        str="[{\"id\":\""+xzqh.getXzqh_dm()+"\",\"text\":\""+xzqh.getXzqh_mc()+"\"}]";
                        
                }else{
                        str=daoXzqh.getXzqhList(node);
                }
                this.out(str);
        }
        /**
         * 获取税务机关列表
         */
        public void getOrgList() {
                String str;
                HttpServletRequest request=ServletActionContext.getRequest();
                HttpSession session=request.getSession();
                if (node.equals("root")){
                        //str="[{\"id\":\""+session.getAttribute("swjg_dm")+"\",\"text\":\""+session.getAttribute("swjg_mc")+"\"}]";
                        if (session.getAttribute("swjg_dm").equals("11305000000")) {
                                str="[{\"id\":\""+session.getAttribute("swjg_dm")+"\",\"text\":\""+session.getAttribute("swjg_mc")+"\"}]";
                        }else{
                                str="[{\"id\":\""+session.getAttribute("swjg_dm")+"\",\"text\":\""+session.getAttribute("swjg_mc")+"\",\"leaf\":1}]";
                        }
                        
                }else{
                        DaoSwjg daoSwjg=new DaoSwjg();
                        str=daoSwjg.getSwjgListforParentID(node);

                }
                this.out(str);
        }

}
